<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>我的评价</title>
	<link rel="icon" href="./img/favicon.ico">


	<link rel="stylesheet" type="text/css" href="./css/all.css" />
	<link rel="stylesheet" type="text/css" href="./css/pages-application.css" />
	<link rel="stylesheet" type="text/css" href="./css/pages-mycomment.css" />
</head>

<body>
	<!-- 头部栏位 -->
	<!--页面顶部-->
	<div id="nav-bottom">
		<!--顶部-->
		<div class="nav-top">
			<div class="top">
				<div class="py-container">
					<div class="shortcut">
						<ul class="fl">
							<li class="f-item">德源欢迎您！</li>
							<li class="f-item">请
								<a href="login.html" target="_blank">登录</a>
								<span>
									<a href="register.html" target="_blank">免费注册</a>
								</span>
							</li>
						</ul>
						<div class="fr typelist">
							<ul class="types">
								<li class="f-item">
									<span>我的订单</span>
								</li>

								<li class="f-item">
									<span>
										<a href="cart.html" target="_blank">我的购物车</a>
									</span>
								</li>
								<li class="f-item">
									<span>
										<a href="home.html" target="_blank">我的德源</a>
									</span>
								</li>
								<li class="f-item">
									<span>德源会员</span>
								</li>
								<li class="f-item">
									<span>企业采购</span>
								</li>
								<li class="f-item">
									<span>关注德源</span>
								</li>
								<li class="f-item">
									<span>
										<a href="cooperation.html" target="_blank">合作招商</a>
									</span>
								</li>
								<li class="f-item">
									<span>
										<a href="shoplogin.html" target="_blank">商家后台</a>
									</span>
								</li>
								<li class="f-item">
									<span>网站导航</li>
							</ul>
						</div>

					</div>
				</div>
			</div>

			<!--头部-->
			<div class="header">
				<div class="py-container">
					<div class="yui3-g Logo">
						<div class="yui3-u Left logoArea">
							<a class="logo-bd" title="德源" href="index.html" target="_blank"></a>
						</div>
						<div class="yui3-u Rit searchArea">
							<div class="search">
								<form action="" class="sui-form form-inline">
									<!--searchAutoComplete-->
									<div class="input-append">
										<input type="text" id="autocomplete" class="input-error input-xxlarge" />
										<button class="sui-btn btn-xlarge btn-danger" type="button">搜索</button>
									</div>
								</form>
							</div>
						</div>

					</div>

				</div>
			</div>
		</div>
	</div>

	<!-- 评价订单 -->
	<div class="mycomment">
		<div class="py-container">
			<div class="head">
				<p class="tit">评价订单</p>
				<p class="num">
					<span class="gray">订单号：</span>6456952641&nbsp;&nbsp;&nbsp;&nbsp;
									<span class="gray">2017-09-22 09:06:05</span>
									</p>
						</div>
						<div class="service">
							<div class="left">
								<div class="inner">
									<img src="./img/_/bg-who1.png" />
									<div class="text">
										<p class="title">店铺名称</p>
										<ul class="remark">
											<li>
												<span>综合</span>
												<span>4.5</span>
											</li>
											<li>
												<span>商品</span>
												<span>4.5</span>
											</li>
											<li>
												<span>服务</span>
												<span>4.5</span>
											</li>
											<li>
												<span>物流</span>
												<span>4.5</span>
											</li>
										</ul>


									</div>
									<div style="clear:both"></div>
								</div>
							</div>
							<div class="stars">
								<ul>
									<li id="goodsconformity">
										商品符合度
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
									</li>
									<li id="bossscore">
										店家服务态度
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
									</li>
									<li id="logisticsscore">物流发货速度：
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
									</li>
									<li id="Deliverymanscore">配送员服务
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<i class="sui-icon icon-tb-favor"></i>
										<li>
								</ul>
							</div>
							<div style="clear:both"></div>
						</div>
						<div style="clear:both"></div>
						<div class="goods">
							<div class="good-item">
								<div class="left">
									<div class="img-intro">
										<img src="./img/_/goods1.jpg" />
										<p>
											<a href="#">维达(Vinda) 抽纸 柔滑3层100抽软抽*8包(新老包装随机发放)</a>
										</p>
										<p>¥32.00</p>
										<p class="gray">3层100抽*8包（柔滑）</p>
									</div>
								</div>
								<div class="right">
									<div class="summary-wrap clearfix">
										<dl>
											<dt>商品评分</dt>
											<span id="itemscore">
									<i class="sui-icon icon-tb-favor"></i>
									<i class="sui-icon icon-tb-favor"></i>
									<i class="sui-icon icon-tb-favor"></i>
									<i class="sui-icon icon-tb-favor"></i>
									<i class="sui-icon icon-tb-favor"></i>
								</span>
										</dl>
										<dl>
											<dt>评价晒单</dt>
											<div class="input">
												<textarea id="inputComment" name="inputComment" placeholder="商品是否给力？快分享你的购物心得吧~" onkeyup="checkLen(this)"></textarea>
											</div>
											<div class="bottom-tool">
												<div class="wordnumber">还可以输入
													<span id="count">500</span> 个文字</div>
											</div>
										</dl>
										<!-- upload -->
										<div class="image-upload" id="image-upload">
											<div id="showimg">
												<ul id="showui">
												</ul>

												<div id="showinput">

												</div>
											</div>
											<div class="upimg">
												<input type="file" id="upgteimg" placeholder="上传图片" value="上传图片" multiple />

											</div>
											<!-- <span class="number">已上传 3 件，还能上传6张</span> -->
											<!-- <button class="btn" id="submit">开始上传</button> -->
										</div>
										<!-- upload end -->
									</div>
								</div>
								<div style="clear:both"></div>
							</div>
						</div>
						<div class="submit">
							<button class="sui-btn btn-danger btn-submit" id="submit">提交</button>
							<input type="radio" name="type" value="1">
							<span>匿名评价</span>
						</div>

					</div>
				</div>

				<!-- 底部栏位 -->
				<!--页面底部-->
				<div class="clearfix footer">
					<div class="py-container">
						<div class="footlink">
							<div class="Mod-service">
								<ul class="Mod-Service-list">
									<li class="grid-service-item intro  intro1">

										<i class="serivce-item fl"></i>
										<div class="service-text">
											<h4>正品保障</h4>
											<p>正品保障，提供发票</p>
										</div>

									</li>
									<li class="grid-service-item  intro intro2">

										<i class="serivce-item fl"></i>
										<div class="service-text">
											<h4>正品保障</h4>
											<p>正品保障，提供发票</p>
										</div>

									</li>
									<li class="grid-service-item intro  intro3">

										<i class="serivce-item fl"></i>
										<div class="service-text">
											<h4>正品保障</h4>
											<p>正品保障，提供发票</p>
										</div>

									</li>
									<li class="grid-service-item  intro intro4">

										<i class="serivce-item fl"></i>
										<div class="service-text">
											<h4>正品保障</h4>
											<p>正品保障，提供发票</p>
										</div>

									</li>
									<li class="grid-service-item intro intro5">

										<i class="serivce-item fl"></i>
										<div class="service-text">
											<h4>正品保障</h4>
											<p>正品保障，提供发票</p>
										</div>

									</li>
								</ul>
							</div>
							<div class="clearfix Mod-list">
								<div class="yui3-g">
									<div class="yui3-u-1-6">
										<h4>购物指南</h4>
										<ul class="unstyled">
											<li>购物流程</li>
											<li>会员介绍</li>
											<li>生活旅行/团购</li>
											<li>常见问题</li>
											<li>购物指南</li>
										</ul>

									</div>
									<div class="yui3-u-1-6">
										<h4>配送方式</h4>
										<ul class="unstyled">
											<li>上门自提</li>
											<li>211限时达</li>
											<li>配送服务查询</li>
											<li>配送费收取标准</li>
											<li>海外配送</li>
										</ul>
									</div>
									<div class="yui3-u-1-6">
										<h4>支付方式</h4>
										<ul class="unstyled">
											<li>货到付款</li>
											<li>在线支付</li>
											<li>分期付款</li>
											<li>邮局汇款</li>
											<li>公司转账</li>
										</ul>
									</div>
									<div class="yui3-u-1-6">
										<h4>售后服务</h4>
										<ul class="unstyled">
											<li>售后政策</li>
											<li>价格保护</li>
											<li>退款说明</li>
											<li>返修/退换货</li>
											<li>取消订单</li>
										</ul>
									</div>
									<div class="yui3-u-1-6">
										<h4>特色服务</h4>
										<ul class="unstyled">
											<li>夺宝岛</li>
											<li>DIY装机</li>
											<li>延保服务</li>
											<li>德源购E卡</li>
											<li>德源购通信</li>
										</ul>
									</div>
									<div class="yui3-u-1-6">
										<h4>帮助中心</h4>
										<img src="./img/wx_cz.jpg">
									</div>
								</div>
							</div>
							<div class="Mod-copyright">
								<ul class="helpLink">
									<li>关于我们
										<span class="space"></span>
									</li>
									<li>联系我们
										<span class="space"></span>
									</li>
									<li>关于我们
										<span class="space"></span>
									</li>
									<li>商家入驻
										<span class="space"></span>
									</li>
									<li>营销中心
										<span class="space"></span>
									</li>
									<li>友情链接
										<span class="space"></span>
									</li>
									<li>关于我们
										<span class="space"></span>
									</li>
									<li>营销中心
										<span class="space"></span>
									</li>
									<li>友情链接
										<span class="space"></span>
									</li>
									<li>关于我们</li>
									<input hidden="hidden" id="comId"/>
								</ul>
								<p>地址：北京昌平 邮编：100096 电话：400-000-0000 传真：000-00000000</p>
								<p>京ICP备000-000-0000号京公网安备000-000-0000</p>
							</div>
						</div>
					</div>
				</div>
				<!--页面底部END-->
				<script type="text/javascript" src="./js/plugins/jquery/jquery.min.js"></script>
				<script type="text/javascript" src="./js/pages/updateimg.js"></script>
				<script>
					function checkLen(obj) {
						var maxChars = 500; //最多字符数 if (obj.value.length > maxChars) obj.value = obj.value.substring(0,maxChars);
						var curr = maxChars - obj.value.length;
						document.getElementById("count").innerHTML = curr.toString();
					}
					$(function () {
						//获取url中的参数
						function getUrlParam(name) {
							var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
							var r = window.location.search.substr(1).match(reg);  //匹配目标参数
							if (r != null) return unescape(r[2]); return null; //返回参数值
						}
						console.log($('#showui li').length)
						var orderid = getUrlParam("orderid");
							var id;
						console.log(orderid);
						inite();
					
						function inite() {
							$.ajax({
								type: "GET",
								url: "http://localhost:9127/comment/findByOrderId.do?orderid=" + orderid,
								success: function (message) {
									if (message != null) {

										//店家服务态度
										$('#comId').val( message.id);
										var goods_Conformity = $('#bossscore >i');
										for (var i = 0; i < message.bossscore; i++) {

											if (goods_Conformity[i].className = "sui-icon icon-tb-favorfill") {

											}
										}
										//物流发货速度

										var goods_Conformity = $('#logisticsscore >i');
										for (var i = 0; i < message.logisticsscore; i++) {
											if (goods_Conformity[i].className = "sui-icon icon-tb-favorfill") {

											}
										}
										//配送员服务
										var goods_Conformity = $('#Deliverymanscore >i');
										for (var i = 0; i < message.Deliverymanscore; i++) {
											if (goods_Conformity[i].className = "sui-icon icon-tb-favorfill") {

											}
										}
										//配送员服务

										var goods_Conformity = $('#itemscore >i');
										for (var i = 0; i < message.itemscore; i++) {
											if (goods_Conformity[i].className = "sui-icon icon-tb-favorfill") {

											}
										}

										//获取商品符合度	

										var goods_Conformity = $('#goodsconformity >i');
										for (var i = 0; i < message.goodsconformity; i++) {
											if (goods_Conformity[i].className = "sui-icon icon-tb-favorfill") {

											}
										}


									}
								},
								error: function (message) {
									alert(message);
								}
							});
						}
						//

						$('#submit').click(function () {

							//获取图片
							var images = $('#showui').find('li');
							var image=[];
							for (var i = 0; i < images.length; i++) {

								image.push(images[i].getElementsByTagName('img')[0].getAttribute("src"));
							}
								//
							var imagID;
							function getimageData() {
								return image;
							}
							$.ajax({
								type: "POST",
								async: false,
								url: "http://localhost:9127/comment/SaveImage.do",
								contentType: "application/json; charset=utf-8",
								dataType: "json",
								data: JSON.stringify(getimageData()),
								success: function (message) {
									console.log(message);
									if (message.code == 0) {


									}
									else {
										imagID = message;
									}
								},
								error: function (message) {

									alert(message);
									return;
								}
							});

							//
							function GetJsonData() {
								return {
									"content": $('#inputComment').val(),
									"image": imagID,
									"commentype": 1,
									"nickname": "张三",
									"orderid": "6456952641",
									"username":"zhangsan"
								}
							}

							$.ajax({
								type: "POST",
								url: "http://localhost:9127/comment/sysadd.do?id=" + $('#comId').val(),
								contentType: "application/json; charset=utf-8",
								data: JSON.stringify(GetJsonData()),
								dataType: "json",
								success: function (message) {
									if (message.code == 0) {
										alert("追加已提交！");

									}
									else {
										alert(message);
									}
								},
								error: function (message) {
									alert(message);
								}
							});


						});


						//


					})
				</script>
</body>

</html>